<!--
--审批页面
-->
<template>
  <!-- 审批中 -->
  <div class="box clearfix">
    <section class="section_wrap">
      <FunctionalAreas></FunctionalAreas>
      <div class="title_sub prduct_bod_r">产品说明：</div>
      <ProductDescriptionToo></ProductDescriptionToo>
    </section>
    <section class="section_wrap">
      <div class="title_sub infro_bod_l">信息查看：</div>
      <div class="state">状态：审批中</div>
      <InformationsViewer
        :reviewer="reviewer"
        v-if="template === 'template_01'"
        :orderNumber="orderNumber"
        :showButton="showButton"
      ></InformationsViewer>
      <InformationsViewer02
        v-if="template === 'template_02'"
        :orderNumber="orderNumber"
        :showButton="showButton"
      ></InformationsViewer02>
    </section>
    <section class="section_wrap" v-if="showFinancialInfo">
      <div class="title_sub infro_bod_l">财务信息:</div>
      <financialInfo :showBtn="showBtn" :orderNumber="orderNumber"></financialInfo>
    </section>
    <section class="section_wrap">
      <div class="title_sub infro_bod_l">风控大数据查询:</div>
      <viewInfo></viewInfo>
    </section>
    <!-- <section class="section_wrap" v-if="isContract != 0">
      <p>客户姓名：{{ showForm.basicBorrowerName }}</p>
      <el-button
        type="primary"
        style="width: 150px; margin-top: 20px"
        @click="cheackFun"
        >合同模板下载</el-button
      >
      <el-dialog
        title="信息核对"
        :visible.sync="dialogVisible"
        :before-close="handleCloseCheck"
        width="1000px"
      >
        <checkDia
          :showForm="showForm"
          :isContract="isContract"
          ref="CheckDia"
        ></checkDia>
      </el-dialog>
    </section> -->
    <section class="section_wrap" v-show="showFillAnIn">
      <div class="title_sub infro_bod_l">审批信息：</div>
      <FillAnInFormation
        @showbox="toshow"
        :orderNumber="orderNumber"
      ></FillAnInFormation>
    </section>
    <section class="section_wrap">
      <div class="title_sub upload_bod_l">附件管理：</div>
      <!-- 上传组件 -->
      <Upload class="uploadStyle" :isNew="isNew"></Upload>
    </section>
    <section class="section_wrap">
      <div class="title_sub appro_bod_r">审批流：</div>
      <ExaminationApproval :ProductUrl="ProductUrl"></ExaminationApproval>
      <div class="title_sub infro_bod_l">操作记录：</div>
      <OperationRecords :orderNumber="orderNumber"></OperationRecords>
    </section>
  </div>
</template>

<script>
import {
  getProductUrl,
  getFindForm,
  getOrderOne
} from "../../../src/assets/js/api";
import FunctionalAreas from "../../components/meitList/FunctionalAreas";
import ProductDescriptionToo from "../../components/meitList/ProductDescriptionToo";
import InformationsViewer from "../../components/meitList/InformationsViewer";
import InformationsViewer02 from "../../components/meitList/InformationsViewer02";
import FillAnInFormation from "../../components/meitList/FillAnInFormation";
import Upload from "../../components/meitList/Upload";
import ExaminationApproval from "../../components/meitList/ExaminationApproval";
import OperationRecords from "../../components/meitList/OperationRecords";
// import checkDia from "../../components/InformationCheck/Check";
import viewInfo from "../../components/business/viweInfo.vue";
import { checkPermiss } from "../../assets/js/utlis";
import financialInfo from "../../components/business/financialInfo";

export default {
  name: "Examination",
  components: {
    FunctionalAreas,
    ProductDescriptionToo,
    InformationsViewer,
    InformationsViewer02,
    Upload,
    ExaminationApproval,
    FillAnInFormation,
    OperationRecords,
    viewInfo,
    // checkDia
    financialInfo
  },
  data() {
    return {
      reviewer: null, //判断晒否是审件专员!1是,0不是!
      prductId: "",
      isNew: false,
      orderNumber: "",
      markUpdate: "",
      showButton: false,
      ProductUrl: "",
      showFillAnIn: true,
      dialogVisible: false,
      showForm: {},
      isContract: "",
      template: "",
      golbalPermissions: []
    };
  },
  created() {
    this.prductId = parseInt(sessionStorage.getItem("prductId"));
    this.getOrderNum();
    this.getList();
    this.getOrderOne(this.prductId);
    this.golbalPermissions = localStorage.getItem("permissions").split(",");
    // console.log(this.golbalPermissions);
    // let index=this.golbalPermissions.indexOf('business:updateFinancial:ryd');
    // console.log('-*------',index)


  },
  computed: {
    //财务信息按钮显示
    showBtn: function() {
      return checkPermiss("business:updateFinancial:ryd", this.golbalPermissions);
    },
    //财务信息
    showFinancialInfo: function() {
      return checkPermiss("business:upForm:financial:ryd", this.golbalPermissions);
    }
  },
  mounted() {
    this.getProductUrl();

  },
  methods: {
    //查询产品模板
    getOrderOne(id) {
      getOrderOne(id).then(res => {
        this.template = res.data.pcCode;
      });
    },
    // cheackFun() {
    //   this.dialogVisible = true;
    // },
    getOrderNum() {
      let orderNumber = this.$route.query.orderNumber;
      if (orderNumber) {
        this.orderNumber = orderNumber;
      } else {
        this.orderNumber = sessionStorage.getItem("orderNumber");
      }
    },
    getList() {
      getFindForm({ orderNumber: this.orderNumber }).then(res => {
        this.showForm = res.data;
      });
    },
    toshow(msg) {
      this.showFillAnIn = msg;
    },
    handleCloseCheck(done) {
      this.$confirm("确认关闭？")
        .then(() => {
          done();
          this.$refs.CheckDia.formResetFields(true);
        })
        .catch(() => {
        });
    },
    //根据orderNumber判断跳转的产品路径
    async getProductUrl() {
      await getProductUrl({ orderNumber: this.orderNumber }).then(res => {
        this.ProductUrl = res.data.productUrl;
        this.isContract = res.data.isContract;
        this.reviewer = res.data.reviewer; //是否是审件专员,1是0不是!
      });

    }
  }
};
</script>

<style scoped type="less">
.text {
  font-size: 20px;
  font-weight: bold;
  text-align: left;
  margin-top: 20px;
  text-indent: 2em;
}

.state {
  font-size: 22px;
  font-weight: bold;
  float: right;
  margin-top: -30px;
  margin-right: 3%;
}

.uploadStyle {
  position: relative;
  margin-top: 20px;
}

/deep/ .aa {
  position: relative;
}

/deep/ .dd {
  width: 65%;
  text-align: center;
}

/deep/ .bb {
  position: absolute;
  left: 60px;
}

/deep/ .cc {
  position: absolute;
  right: 8px;
  color: black;
  font-weight: bold;
}


</style>
